package com.smartleanx.module.hrm.eums.employee;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

@Getter
@RequiredArgsConstructor
public enum SeparationTypeEnum {

    VOLUNTARY_RESIGNATION(1, "主动离职"),
    PASSIVE_RESIGNATION(2, "被动离职"),
    RETIRE(3, "退休"),
    ;

    private final Integer code;

    private final String desc;

    SeparationTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code返回desc
     *
     * @param code 编号
     * @return 名称
     */
    public static String getDesc(Integer code) {
        for (SeparationTypeEnum e : SeparationTypeEnum.values()) {
            if (e.getCode().equals(code)) {
                return e.getDesc();
            }
        }
        return null;
    }

}
